package com.example.demo02.utils;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by lq on 16/02/2.
 */

@Component
public class ParamUtils {

    private static MyRedisUtils myRedisUtils;

    @Autowired
    public void setRedisTemplate(MyRedisUtils myRedisUtils) {
        ParamUtils.myRedisUtils = myRedisUtils;
    }


    public static String getParamMemo(String code, String value) {
        try {
            if (value == null || value.equals("")) {
                return null;
            }
            //depttype多数为空，如果放在上面一起判断，可能会影响其他程序
            if ("depttype".equals(code) && "".equals(value)) {
                return null;
            }
//            return (PARAMETER_MAP.get(code)).getTparamitems().get(value).getItemmemo();
            return myRedisUtils.getParameterValue(code, value);
        } catch (Exception e) {
            System.out.print("不存在的代码：" + code + ",值：" + value);
            e.printStackTrace();
            return null;
        }
    }


}


